package pe.gob.sunarp.entidad;

import java.io.Serializable;
import javax.persistence.*;

/**
 * The primary key class for the CRITERIOS_ASIGNA database table.
 * 
 */
@Embeddable
public class CriteriosAsignaPK implements Serializable {
	//default serial version id, required for serializable classes.
	private static final long serialVersionUID = 1L;
	private long cuentaId;
	private String regPubId;
	private String oficRegId;
	private long certificadoId;
	private long grupoId;

    public CriteriosAsignaPK() {
    }

	@Column(name="CUENTA_ID", unique=true, nullable=false)
	public long getCuentaId() {
		return this.cuentaId;
	}
	public void setCuentaId(long cuentaId) {
		this.cuentaId = cuentaId;
	}

	@Column(name="REG_PUB_ID", unique=true, nullable=false, length=2)
	public String getRegPubId() {
		return this.regPubId;
	}
	public void setRegPubId(String regPubId) {
		this.regPubId = regPubId;
	}

	@Column(name="OFIC_REG_ID", unique=true, nullable=false, length=2)
	public String getOficRegId() {
		return this.oficRegId;
	}
	public void setOficRegId(String oficRegId) {
		this.oficRegId = oficRegId;
	}

	@Column(name="CERTIFICADO_ID", unique=true, nullable=false)
	public long getCertificadoId() {
		return this.certificadoId;
	}
	public void setCertificadoId(long certificadoId) {
		this.certificadoId = certificadoId;
	}

	@Column(name="GRUPO_ID", unique=true, nullable=false)
	public long getGrupoId() {
		return this.grupoId;
	}
	public void setGrupoId(long grupoId) {
		this.grupoId = grupoId;
	}

	public boolean equals(Object other) {
		if (this == other) {
			return true;
		}
		if (!(other instanceof CriteriosAsignaPK)) {
			return false;
		}
		CriteriosAsignaPK castOther = (CriteriosAsignaPK)other;
		return 
			(this.cuentaId == castOther.cuentaId)
			&& this.regPubId.equals(castOther.regPubId)
			&& this.oficRegId.equals(castOther.oficRegId)
			&& (this.certificadoId == castOther.certificadoId)
			&& (this.grupoId == castOther.grupoId);

    }
    
	public int hashCode() {
		final int prime = 31;
		int hash = 17;
		hash = hash * prime + ((int) (this.cuentaId ^ (this.cuentaId >>> 32)));
		hash = hash * prime + this.regPubId.hashCode();
		hash = hash * prime + this.oficRegId.hashCode();
		hash = hash * prime + ((int) (this.certificadoId ^ (this.certificadoId >>> 32)));
		hash = hash * prime + ((int) (this.grupoId ^ (this.grupoId >>> 32)));
		
		return hash;
    }
}